/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rom.script;

import java.io.Serializable;
import java.util.ArrayList;

/**
 *
 * @author Luis
 */
public class Script implements Serializable{
    
    private ArrayList<Bonus> bonus = new ArrayList<>();
    
    public Script() {
    }
    
    public Script(Bonus bonus) {
        if (!this.bonus.contains(bonus)) {
            this.bonus.add(bonus);
        }
    }
    
    public void addBonus(Bonus bonus) {
        if (!this.bonus.contains(bonus)) {
            this.bonus.add(bonus);
        }
    }
    
    public void removeBonus(Bonus bonus) {
        if (this.bonus.contains(bonus)) {
            this.bonus.remove(bonus);
        }
    }
    
    public Bonus getBonus(int index) {
        if (this.bonus.size() >= index) {
            return this.bonus.get(index);
        }
        return null;
    }
    
    @Override
    public String toString() {
        String out = "";
        for (Bonus b : this.bonus) {
            out += b + ";";
        }
        return out;
    }
}
